package com.riguz.forks.framework.plugin.system;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.riguz.forks.framework.Framework;
import com.riguz.forks.framework.plugin.Plugin;
import com.riguz.forks.framework.route.Route;
import com.riguz.forks.framework.route.RouteLoader;

public class RoutePlugin implements Plugin{
    private static final Logger logger = LoggerFactory.getLogger(RoutePlugin.class);
    
    @Override
    public String getPluginInfo() {
        return "Forks Route plugin";
    }

    @Override
    public boolean init() {
        RouteLoader loader = Framework.getRouteLoader();
        Route r = loader.load();
        if(r == null){
            logger.error("Failed to load route");
            return false;
        }
        r.complete();
        return true;
    }

    @Override
    public void destroy() {
        //nothing to do
    }

}
